/*
 * @Author: fishroom
 * @Date: 2021-08-22 19:50:32
 * @LastEditTime: 2021-09-07 15:21:23
 * @FilePath: \backstage\src\store\mutations.js
 */

import router from "../router/index.js";
export default {
  // 首页轮播图
  homeBanner(state, res) {
    console.log(res);
  },
  // 登录判断
  getLogin(state, data) {
    if (data == "username") {
      alert("账号不存在");
    } else if (data == "password") {
      alert("密码错误");
    } else {
      alert("登录成功");
      localStorage.setItem("token", data);
      router.push("/background");
    }
  },
  // locationStorage 存储 token
  set_token(state, token) {
    state.token = token;
    localStorage.token = token;
  },
  // locationStorage 删除token
  del_token(state) {
    state.token = "";
    localStorage.removeItem("token");
  },
  getbackList(state, data) {
    data.forEach(e => {
      state.list.push(e);
    });
  },
  // 资产页下拉框
  getPropertySelectList(state, list) {
    list.forEach(e => {
      state.selectList.push(e);
    });
  },
  //资产页分页数据
  getPropertyItemList(state, obj) {
    state.PropertyItemList = [];
    state.PropertyItemList = obj.list;
    state.PropertyLength = obj.length;
  },
  //资产页分页数据
  ProQueryItem(state, obj) {
    state.PropertyItemList = [];
    state.PropertyItemList = obj;
    state.PropertyLength = obj.length;
  },
  //获取详情
  getDetail(state, list) {
    state.DetailItemList = [];
    state.DetailItemList = list;
  },

  // 地图页
  getMapSelectList(state, list) {
    list.forEach(e => {
      state.mapSelectList.push(e);
    });
  },
  getMapSearchList(state, list) {
    state.MapSearchList = [];
    state.MapSearchList = list;
  },
  getType(state, list) {
    state.TypeList = list;
  },
  getEvl(state, list) {
    state.environment = list;
  },

  // 后台-基础信息-所有信息列表
  GetAllInfo(state, res) {
    state.AllInfo = res;
  },
  // 后台-基础信息-所有信息列表-详情
  GetCurrentInfo(state, res) {
    state.currentInfo = res;
  },
  // 后台-营房操作-所有信息列表
  GetbarInfo(state, res) {
    state.barracksInfo = res;
  },
  // 后台-营房操作-获取单条数据
  GetBarracksCurInfo(state, res) {
    state.currentBarracksInfo = res;
  },
  // 后台-酒店操作-所有信息列表
  GetHotelInfo(state, res) {
    state.hotelInfo = res;
  },
  // 后台-酒店操作-所有信息列表-详情
  GetHotelCurInfo(state, res) {
    state.currentHotelInfo = res;
  },
  // 后台-靶场操作-所有列表信息
  GetRangeInfo(state, res) {
    state.rangesInfo = res;
  },

  // 后台-靶场操作-获取单条数据
  GetRangesCurInfo(state, res) {
    state.currentRangesInfo = res;
  },
  // 后台-仓储操作-所有列表信息
  GetStorangeInfo(state, res) {
    state.storangeInfo = res;
  },

  // 后台-仓储操作-获取单条数据
  GetStorageCurInfo(state, res) {
    state.currentStorageInfo = res;
  },
  // 后台-养殖场操作-所有列表信息
  GetFarmInfo(state, res) {
    state.farmInfo = res;
    console.log(state.farmInfo);
  },

  // 后台-养殖场操作-获取单条数据
  GetFarmCurInfo(state, res) {
    state.currentFarmInfo = res;
  },
  // 后台-历史沿革-所有列表信息
  GetHistoryInfo(state, res) {
    // state.historyInfo =res;
    for (let i of res) {
      state.historyInfo.push(i);
    }
  },

  // 后台-历史沿革-获取单条数据
  GetHistoryCurInfo(state, res) {
    state.currentHistoryInfo = res;
  },
  // 后台-楼栋信息-所有列表信息
  GetFloorInfo(state, res) {
    state.floorInfo = res;
  },

  // 后台-楼栋信息-获取单条数据
  GetFloorCurInfo(state, res) {
    state.currentFloorInfo = res;
  },
  // 后台-设备信息-所有列表信息
  GetFacilityInfo(state, res) {
    state.facilityInfo = res;
  },

  // 后台-设备信息-获取单条数据
  FetFacillityCurInfo(state, res) {
    state.currentFacilityInfo = res;
  },
  // 后台-遗留问题-所有信息列表
  GetLeftProblemInfo(state, res) {
    state.leftProblem = res;
  },

  // 后台-遗留问题-获取单条数据
  GetLeftProblemCurInfo(state, res) {
    state.currentLeftProblemInfo = res;
  },
  // 后台-电梯问题-所有信息列表
  GetElevatorInfo(state, res) {
    state.elevatorInfo = res;
  },

  // 后台-电梯问题-获取单条数据
  GetElevatorCurInfo(state, res) {
    state.currentElevatorInfo = res;
  },
  // 后台-工程信息-所有列表信息
  GetProjectInfo(state, res) {
    state.projectInfo = res;
  },

  // 后台-工程信息-获取单条数据
  GetProjectCurInfo(state, res) {
    state.currentProjectInfo = res;
  },

  // 搜索-工程信息
  SearchProjectInfo(state, res) {
    state.searchInfo = res;
  },
  // 上传图片
  UploadPhoto(state, res) {
    state.uploadIng = res;
  },
  // 字典类型查询
  getDictionaryItem(state, list) {
    state.DictionaryList = list;
  },

  // 字典总条目数
  getDictionaryLen(state, len) {
    state.DictionaryItemLen = len;
  },
  // 所有用户
  getUser(state, list) {
    state.userList = list.list;
    state.DictionaryItemLen = list.total;
  },

  // 删除

  // 基础信息
  DelInfo(state, res) {
    state.deleteInfo = res;
  },
  // 营房操作
  DelBarracksInfo(state, res) {
    state.deleteBarracksInfo = res;
  },
  //酒店操作
  DelHotelInfo(state, res) {
    state.deleteHotelInfo = res;
  },
  // 靶场操作
  DelRangeInfo(state, res) {
    state.deleteRangeInfo = res;
  },
  // 仓储操作
  DelStorageInfo(state, res) {
    state.deleteStorageInfo = res;
  },
  // 养殖场操作
  DelFarmInfo(state, res) {
    state.deleteFarmInfo = res;
  },
  // 历史沿革
  DelHistoryInfo(state, res) {
    state.deleteHostoryInfo = res;
  },
  // 楼栋信息
  DelFloorInfo(state, res) {
    state.deleteFloorInfo = res;
  },
  // 设备信息
  DelFacilityInfo(state, res) {
    state.deleteFacilityInfo = res;
  },
  // 遗留问题
  DelLeftProblemInfo(state, res) {
    state.deleteLeftProblemInfo = res;
  },
  // 电梯信息
  DelElevatorInfo(state, res) {
    state.deleteElevatorInfo = res;
  },
  // 工程信息
  DelProjectInfo(state, res) {
    state.deleteProjectInfo = res;
  },

  // 新增
  // 基础信息
  IncInfo(state, res) {
    state.increatInfo = res;
  },
  // 营房操作
  IncBarracksInfo(state, res) {
    state.increatBarrackInfo = res;
  },
  // 酒店操作
  IncHotelInfo(state, res) {
    state.increatHotelInfo = res;
  },
  // 靶场操作
  IncRangeInfo(state, res) {
    state.increatRangeInfo = res;
  },
  // 仓储操作
  IncStorageInfo(state, res) {
    state.increatStorageInfo = res;
  },
  // 养殖场操作
  IncFarmInfo(state, res) {
    state.increatFarmInfo = res;
  },
  // 历史沿革
  IncHistoryInfo(state, res) {
    state.increatHistoryInfo = res;
  },
  // 楼栋信息
  IncFloorInfo(state, res) {
    state.increateFloorInfo = res;
    console.log(state.increateFloorInfo);
  },
  // 设备信息
  IncFacilityInfo(state, res) {
    state.increateFacilityInfo = res;
  },
  // 遗留问题
  IncLeftProblemInfo(state, res) {
    state.increatLeftProblemInfo = res;
  },
  // 电梯信息
  IncElevatorInfo(state, res) {
    state.increatElevatorInfo = res;
  },
  // 工程信息
  IncProjectInfo(state, res) {
    state.increatProjectInfo = res;
  },

  // 编辑
  // 基础信息
  EdInfo(state, res) {
    state.editInfo = res;
  },
  // 营房操作
  EdBarracksInfo(state, res) {
    state.editBarracksInfo = res;
  },
  // 酒店操作
  EdHotelInfo(state, res) {
    state.editHotelInfo = res;
  },
  // 靶场操作
  EdRangeInfo(state, res) {
    state.editRangeInfo = res;
  },
  // 仓储操作
  EdStorangeInfo(state, res) {
    state.editStorangeInfo = res;
  },
  // 养殖场操作
  EdFarmInfo(state, res) {
    state.editFarmInfo = res;
  },
  // 历史沿革
  EdHistoryInfo(state, res) {
    state.editHistoryInfo = res;
  },
  // 楼栋信息
  EdFloorInfo(state, res) {
    state.editFloorInfo = res;
  },
  // 设备信息
  EdFacilityInfo(state, res) {
    state.editFacilityInfo = res;
  },
  // 遗留问题
  EdLeftProblemInfo(state, res) {
    state.editLeftProblemInfo = res;
  },
  // 电梯信息

  EdElevatorInfo(state, res) {
    state.editElevatorInfo = res;
  },
  // 工程信息
  EdProjectInfo(state, res) {
    state.editProjectInfo = res;
  }
};
